Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cachable, proxy-friendly selendroid jar download. #36

Merged

Conversation

jgreen210
Copy link
Contributor

  • Download using http from maven central, not https from github. Using
    http avoids many proxy-related problems and makes caching
    easier. Not using github means can use http and also avoids a
    redirection to a temporary and therefore extra-hard-to-cache URL.
  • Download via temporary file, throwing exception if fail, to ensure
    other code can't see bad download.
  • Use SHA256 not MD5 fingerprint, to compensate for use of http.
  • Only check fingerprint on download, but fail if it is wrong instead
    of just logging warning.

@jgreen210
Copy link
Contributor Author

Fixes #24 and also allows me to cache the download with an HTTP proxy.

@jgreen210
Copy link
Contributor Author

jgreen210 commented Sep 9, 2016

This travis build failed when installing appium-selendroid-driver:

https://travis-ci.org/appium/appium-selendroid-driver/jobs/158700317
https://s3.amazonaws.com/archive.travis-ci.org/jobs/158700317/log.txt

...saying:

Error: bad SHA256 fingerprint: 7cbc32cb03411d9714878cb390f1f93ecb9ec76f11341c47827c00dfa7a06c42

It then tries to run the unit tests anyway, which fail since there's no apk or manifest.

When I download the jar locally, I still get the checked-in fingerprints:

$ curl --silent --location https://github.com/selendroid/selendroid/releases/download/0.17.0/selendroid-standalone-0.17.0-with-dependencies.jar | md5sum -
5e1f7de5e4d2eb77b68675d76c5edf6a  -
$ curl --silent --location https://github.com/selendroid/selendroid/releases/download/0.17.0/selendroid-standalone-0.17.0-with-dependencies.jar | shasum --algorithm 256 -
7cf7163ac47f1c46eff95b62f78b58c1dabdec534acc6632da3784739f6e9d82  -
$ curl --silent http://repo1.maven.org/maven2/io/selendroid/selendroid-standalone/0.17.0/selendroid-standalone-0.17.0-with-dependencies.jar | shasum --algorithm 256
7cf7163ac47f1c46eff95b62f78b58c1dabdec534acc6632da3784739f6e9d82  -

@imurchie
Copy link
Contributor

imurchie commented Sep 9, 2016

Is this error something to do with Node 6? It seems to work fine in 4 and 5.

@jgreen210
Copy link
Contributor Author

jgreen210 commented Sep 9, 2016

Tested locally with node 5.4.1 before submitting, but not 6.2.1, which breaks. This is fixed by using Buffer not String to hold body: 27569b2.

@imurchie
Copy link
Contributor

imurchie commented Sep 9, 2016

That would be why we test against multiple versions!

@imurchie
Copy link
Contributor

imurchie commented Sep 9, 2016

Thanks for this! It's awesome!

One thing: can you squash into a single commit? Then we can get it in.

* Download using http from maven central, not https from github. Using
  http avoids many proxy-related problems and makes caching
  easier. Not using github means can use http and also avoids a
  redirection to a temporary and therefore extra-hard-to-cache URL.

* Download via temporary file, throwing exception if fail, to ensure
  other code can't see bad download.

* Use SHA256 not MD5 fingerprint, to compensate for use of http.

* Only check fingerprint on download, but fail if it is wrong instead
  of just logging warning.

* Use Buffer, not String to hold body.

Download using http (from maven central, not github) via temporary file, throwing exception if fail.
@jgreen210 jgreen210 force-pushed the jgreen210-maven-central-install branch from da7d773 to 3325a8b Compare September 9, 2016 13:05
@jgreen210
Copy link
Contributor Author

It's now squashed to one commit.

@imurchie
Copy link
Contributor

imurchie commented Sep 9, 2016

Awesome! Thank you very much for this.

@imurchie imurchie merged commit 10096f6 into appium-boneyard:master Sep 9, 2016
@imurchie
Copy link
Contributor

imurchie commented Sep 9, 2016

Published as [email protected].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants